<template>
  <transition name="fade">
    <div class="food-detail">
      <div class="food-wrapper">
        <div class="food-main">
          <div class="detail-header">
            <div class="pic">
              <div class="outbutton" @click="hide">x</div>
              <div class="title">
                <div class="maintitle">标准美式</div>
                <div class="subtitle">Americano</div>
              </div>
            </div>
          </div>
          <div class="detail-body">
            <div class="food-size">
              <div class="detail-1 detail">
                <div class="detail-size">规格</div>
                <div class="detail-button">
                  <van-button
                    color="#ccc0b4"
                    round
                    type="primary"
                    class="debutton"
                    size="small"
                    >大</van-button
                  >
                  <van-button
                    color="#ccc0b4"
                    round
                    type="primary"
                    plain
                    class="debutton"
                    size="small"
                    >中</van-button
                  >
                  <van-button
                    color="#ccc0b4"
                    round
                    type="primary"
                    plain
                    class="debutton"
                    size="small"
                    >中</van-button
                  >
                </div>
              </div>
              <div class="detail-2 detail">
                <div class="detail-size">糖</div>
                <div class="detail-button">
                  <van-button
                    color="#ccc0b4"
                    round
                    type="primary"
                    class="debutton"
                    size="small"
                    >大</van-button
                  >
                  <van-button
                    color="#ccc0b4"
                    round
                    type="primary"
                    plain
                    class="debutton"
                    size="small"
                    >中</van-button
                  >
                </div>
              </div>
              <div class="detail-3 detail">
                <div class="detail-size">温度</div>
                <div class="detail-button">
                  <van-button
                    color="#ccc0b4"
                    round
                    type="primary"
                    class="debutton"
                    size="small"
                    >大</van-button
                  >
                  <van-button
                    color="#ccc0b4"
                    round
                    type="primary"
                    plain
                    class="debutton"
                    size="small"
                    >中</van-button
                  >
                  <van-button
                    color="#ccc0b4"
                    round
                    type="primary"
                    plain
                    class="debutton"
                    size="small"
                    >中</van-button
                  >
                </div>
              </div>
            </div>
            <div class="dakashuo">
              <div class="dakatitle">{{qwe}}大咖说 </div>
              <div class="faces"><img class="facess" src="../../../../assets/images/category/author1.jpg" alt=""></div>

              <div class="speech">
                <div class="name" style="font-size: 12px;">Andrea Lattuada</div>
                <div class="rank" style="color:#808080" v-html="evaluate"></div>            
              </div>
            </div>
          </div>
          <div class="detail-bar">
            <div class="top-bar">
              <div class="top-bar-price">
                <div class="total-price">￥25</div>
                <div class="price-detail">美式￥21 + 无糖￥ 0</div>
              </div>
              <van-stepper v-model="value" theme="round" button-size="22" disable-input />
              <div class="cartcontrol-wrapper">
                <cart-control ></cart-control>
              </div>
              
            </div>
            <div class="button-bar">
              <van-button class="youhui" color="linear-gradient(to right, #ff6034, #ee0a24)">
                优惠券
              </van-button>
              <van-button class="buyIt" color="#88AFD5">加入购物车</van-button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
import { postGoodsDetail } from "@/api";
// import CartControl from "../../../../components/cart-control.vue/cart-control.vue"
export default {
  props: {
    detailId: {
      type:Object,
      default() {
        return {}
      }
    },
    qwe:{
      type:Object,
    }
  },
  // props:["detailId"],
  components:{
    // CartControl
  },
  data() {
    return {
      goodsDetail: [],
      currentIndex: 0,
      evaluate:"喜欢他家金枪鱼三明治🥪\n虽然想差评面没有加热工具\n但是就算是冷金枪鱼三明治也是吃\n看了去年一整年点评总结\n最多两个字就是吃～\n哈哈哈哈金枪鱼三明治是真吃～\n位于T2一楼luckin就在明面上找～\n"
    };
  },
  created() {
    console.log(this.qwe);
    postGoodsDetail(937175).then((res) => {
      console.log(res);
      this.goodsDetail = res;
    });
  },
  computed:{
    // selectFoods() {
    //   let foods = [];
    //   for (let good of this.goods) {
    //     // let food = this.goods[i].foods;
    //     for (let food of good.foods) {
    //       if (food.count) {
    //         foods.push(food);
    //       }
    //     }
    //   }
    //   console.log(foods);
    //   return foods;
    // },
  },
  methods: {
    hide(){
      // 控制页面消失，要传值 数 据给父组件
      this.$emit('hide', false);
    }
  }
};
</script>

<style lang="less">
.food-detail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 200;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  opacity: 1;
  backdrop-filter: blur(5px);
  .food-wrapper {
  position: relative;
    display: inline-block;
    margin-left: 5%;
    margin-top: 10%;
    width: 90%;
    height: 87%;
    border-radius: 10px;
    background-color: #fff;
    .food-main {
      height: 100%;
      .detail-header {
        .pic {
          position: relative;
          background-image: url(../../../../assets/images/category/dialog1.jpg);
          background-repeat: round;
          width: 100%;
          height: 150px;
          border-top-left-radius: 10px;
          border-top-right-radius: 10px;
          .outbutton {
            position: absolute;
            right:20px;
            margin-top: 12px;
            font-size: 20px;
            color: #fff;
            float: right;
          }
          .title {
            position: absolute;
            margin-left: 15px;
            margin-top: 90px;
            color: #fff;
            .maintitle {
              font-size: 22px;
              font-weight: 600;
            }
            .subtitle {
              font-size: 14px;
            }
          }
        }
      }
      .detail-body {
        overflow: auto;
        margin-top: 20px;
        margin-left: 15px;
        height: 55%;
        .food-size {
        margin-bottom: 20px;
          .detail {
            display: flex;
            margin-bottom: 15px;
            .detail-size {
              margin-top: 5px;
              font-size: 14px;
            }
            .detail-button {
              margin-left: 15px;
              .debutton {
                width: 80px;
                height: 30px;
                margin-left: 10px;
              }
            }
          }
          .detail-2{
            .detail-size{
              margin-right: 15px;
            }
          }
        }
      }
      .dakashuo {

        width: 95%;
        border-top: 1px solid #f2f2f2;
        .dakatitle {
          margin-top: 18px;
          font-size: 13px;
          margin-bottom: 5px;
        }
        .faces{
          width: 30px;
          margin-top: 5px;
          float: left;
        .facess{
            width: 30px;
            height: 30px;
            border-radius: 30px;
          }
        }
        .speech{
        margin-top: 15px;
          margin-left: 40px;
          .rank{
            margin-top: 5px;
          }
        }
      }
      .detail-bar{
        position: absolute;
        width: 100%;
        height: 120px;
        bottom: 0;
        .top-bar{
          height: 60px;
          border-top: 1px solid #F3F3F3;
          border-bottom: 1px solid #F3F3F3;
          .top-bar-price{
            float: left;
            margin-left: 15px;
            .total-price{
            margin-top: 8px;
              font-size: 18px;
            }
            .price-detail{
              margin-top: 2px;
              margin-left: 4px;
            }
          }
        }
        .button-bar{
          .youhui{
            margin-left: 118px;
            margin-right: 10px;
            height: 32px;
            margin-top: 10px;
            width: 85px;
          }
          .buyIt{
            height: 32px;
            margin-top: 10px;
          }
        }
      }
    }
  }
  .fade-enter,
  .fade-leave-to {
    opacity: 0;
    background: rgba(0, 0, 0, 1);
  }
  .fade-enter-active,
  .fade-leave-active {
    transition: all 0.5s;
  }
}
</style>


